/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package telebim;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;

/**
 *
 * @author mejcu
 */
public class Player extends JPanel{
    private Image tank, dead;
    private JLabel nick,avatar;
    private JProgressBar progressBar;
{setOpaque(false);}
    /**
     * 
     * @param imie
     * @param _tank
     * @param _dead
     */
    public Player(String imie, Image _tank, Image _dead)
    {
                tank=_tank;
        dead=_dead;
        setLayout(new BorderLayout());
        nick=new JLabel(imie,JLabel.CENTER);
        avatar=new JLabel(new ImageIcon(tank));
        nick.setFont(new Font("Courier New",Font.BOLD,  25));
        nick.setForeground(Color.WHITE);
        progressBar = new JProgressBar(0, 3);
        progressBar.setValue(3);
        progressBar.setStringPainted(false);
        add(progressBar,BorderLayout.NORTH);
        add(avatar,BorderLayout.CENTER);
        add(nick,BorderLayout.SOUTH);
    }
    /**
     *
     * @param p
     */
    public void setPower(int p){
        progressBar.setValue(p);
        if(p==0){
            avatar.setIcon(new ImageIcon(dead));
        }
    }


}
